﻿Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.Common.Configuration

Public Class DataCommon

    Public Shared db As Database = EnterpriseLibraryContainer.Current.GetInstance(Of Database)()

    Public Shared Function DBNullCheck(ByVal obj As Object) As Object
        DBNullCheck = Nothing
        Try
            If TypeOf obj Is String Then
                DBNullCheck = IIf(IsDBNull(obj), "", obj)
            ElseIf TypeOf obj Is Integer Or TypeOf obj Is Double Or TypeOf obj Is Decimal Or TypeOf obj Is Short Or TypeOf obj Is Long Then
                DBNullCheck = IIf(IsDBNull(obj), 0, obj)
            ElseIf TypeOf obj Is Date Then
                DBNullCheck = IIf(IsDBNull(obj), Date.Now, obj)
            ElseIf TypeOf obj Is Boolean Then
                DBNullCheck = IIf(IsDBNull(obj), False, obj)
            End If
        Catch ex As Exception
            Throw ex
        End Try
    End Function

End Class

Public Enum LookupTypes
    None = 0
    BillCharges = 1
    BillCategory = 2
    PatientType
    PaymentMode
    ItemCategory
    UOM
    EmployeeType
    MaritalStatus
    Relationship
    Specialization
    DoctorType
    RecallType
    RecallStatus
    ProcedureCategory
    RoomType
    AppointmentType
    AppointmentStatus
    ContactType
    VisitStatus
    Habits
    Immunization
    HealthStatus
    Language
    Confidential
    Religion
    BloodGroup
    Diet
    InvestigationCategory
    ProblemTiming
    ProblemDuration
    ProblemLocation
    Severity
    ProblemCategory
    FindingCategory
    MedicineType
    MedicineManufacturer
    GenericDrug
    MedicineFrequency
    Periods
End Enum